{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2 as cv\n",
    "img = cv.imread(\"./lena.jpg\") #读取图像文件\n",
    "imgGauss = cv.GaussianBlur(img, (5, 5), 0) #对图像文件做高斯平滑处理5*5大小的模板\n",
    "image1 = cv.resize(img, (int(img.shape[1]/2), int(img.shape[0]/2)))#改变图像大小缩小一半\n",
    "image2 = cv.pyrDown(image1)#缩小1/4的图像\n",
    "gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)#把原始图像转换为灰色的图像\n",
    "_,gray1 = cv.threshold(gray, 120, 0xff, cv.THRESH_BINARY)#把输入图像预置化灰度图像\n",
    "cv.imshow(\"source image\", img)\n",
    "cv.imshow(\"Gaussian filtered image\", imgGauss)\n",
    "cv.imshow(\"quarter size\", image2)\n",
    "cv.imshow(\"gray\", gray)\n",
    "cv.imshow(\"threshold image\", gray1)\n",
    "cv.waitKey(0)\n",
    "cv.destroyAllWindows()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
